from week3.Page.Page import Page
from selenium.webdriver.common.by import By
class Page1(Page):
    # 先定位
    baidu_search_loc =(By.ID,'kw')
    def baidu_search(self):
        self.send_keys(self.baidu_search_loc,'测试')

    baidu_button_loc = (By.XPATH,'//*[@id="su"]')
    def baidu_button(self):
        self.click(self.baidu_button_loc)

    baidu_text_loc = (By.XPATH,'//*[@id="1"]/div/h3/a/div/div/p')
    def baidu_text(self):
        self.window()
        self.click(self.baidu_text_loc)

    sc_loc = (By.XPATH,'//*[@id="J-lemma-main-wrapper"]/div[2]/div/div[1]/div/div[1]/div/div[1]/svg')
    def sc(self):
        self.click(self.sc_loc)

    search_sc_loc = (By.XPATH,'//*[@id="J-lemma-main-wrapper"]/div[2]/div/div[1]/div/div[1]/div/div[1]/div/a')
    def search_sc(self):
        self.click(self.search_sc_loc)

    cs = (By.XPATH,'//*[@id="J-lemma-main-wrapper"]/div[1]/div/div/div[1]/div/div[1]/h1')
    def cs(self):
        self.text(self.cs)

    def search_badu_002(self):
        self.badu_login_001()
        self.baidu_search()
        self.baidu_button()
        self.baidu_text()
        self.sc()
        assert '测试' == self.cs()